<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
class ScoreRankRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        $id = $this->scorerank->id??0;
        return [
            'score_rank' => ['required', Rule::unique('score_ranks')->ignore($id)],
            'min_score' => ['required', 'numeric', 'lt:max_score'],
            'max_score' => ['required', 'numeric', 'gt:min_score'],

            'median_interests' => ['required', 'numeric'],
            'min_interests' => ['required', 'numeric'],
            'max_interests' => ['required', 'numeric'],
            'message' => ['required', 'max:300'],
        ];
    }
}
